const createAuth = async (params) => {
    return await new Promise((resolve, reject) => {
        axios.post('/index/auth/createAuth', params).then(res => {
            resolve(res)
        }).catch(err => {reject(err)})
    })
}

const getAuthTree = async () => {
    return await new Promise((resolve, reject) => {
        axios.get('/index/auth/getAuthTree', {}).then(res => {
            resolve(res.data.data)
        }).catch(err => {
            reject(err)
        })
    })
}

const delAuth = async (params) => {
    return await new Promise((resolve, reject) => {
        axios.post('/index/auth/delAuth', params).then(res => {
            resolve(res)
        }).catch(err => {reject(err)})
    })
}

const moveSite = async (params) => {
    return await new Promise((resolve, reject) => {
        axios.post('/index/auth/moveSite', params).then(res => {resolve(res)}).catch(err => {reject(err)})
    })
}

const authDetail = async (params) => {
    return await new Promise((resolve, reject) => {
        axios.get('/index/auth/authDetail', params).then(res => {
            resolve(res.data.data)
        }).catch(err => {reject(err)})
    })
}

const editAuth = async (params) => {
    return await new Promise((resolve, reject) => {
        axios.post('/index/auth/saveAuthData', params).then(res => {
            resolve(res)
        }).catch(err => {reject(err)})
    })
}

export default {
    createAuth,
    editAuth,
    delAuth,
    authDetail,
    moveSite,
    getAuthTree
}